package top.rish.rib.base.config;

import org.noear.redisx.RedisClient;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.noear.solon.cache.jedis.RedisCacheService;
import org.noear.solon.data.cache.CacheService;
import org.noear.solon.data.cache.LocalCacheService;
import org.noear.solon.data.cache.impl.JavabinSerializer;
import org.noear.solon.data.cache.impl.JsonSerializer;

import java.util.Properties;

@Configuration
public class CacheConfig {

    @Bean(name = "rib_redis_cache", typed = true)
    public CacheService rib_redis_cache(@Inject("${rib.cache}") RedisCacheService cache){
        cache.enableMd5key(false);
        cache.serializer(JsonSerializer.instance);
        return cache;
    }

    @Bean(name = "rib_local_cache")
    public CacheService rib_local_cache(){
        return LocalCacheService.instance;
    }

}
